package cn.simple.manager.Repository;

import cn.simple.manager.todo.ImageStorage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

@Repository
public interface ImageStorageResponsitory extends JpaRepository<ImageStorage, String> {

    @Query(value = "select tag_name from ( select Tag_name from imagestorage order by sort desc) group by tag_name" ,nativeQuery = true)
     Set<String> getTagGroupByName();

    @Query(value = "select * from ImageStorage where tag_name=:tag", nativeQuery = true)
    List<ImageStorage> selectTagImageStorage(@Param("tag") String tagName);
}
